从上往下打印二叉树： https://www.nowcoder.com/practice/7fe2212963db4790b57431d9ed259701?
/*
struct TreeNode {
int val;
struct TreeNode *left;
struct TreeNode *right;
TreeNode(int x) :
val(x), left(NULL), right(NULL) {
}
};*/
class Solution {
  public:
    vector<int> PrintFromTopToBottom(TreeNode* root) {
        if (root == nullptr) 
		{
            return vector<int>();
        }

        vector<int> v;
        queue<TreeNode*> q;
        q.push(root);
		
        while (!q.empty()) 
		{
            TreeNode* father = q.front();
            q.pop();
            v.push_back(father->val);
            if (father->left) 
			{
				//左子树不为空
                q.push(father->left);
            }
            if (father->right) 
			{
				//右子树不为空
                q.push(father->right);
            }
        }
        return v;
    }
};